package com.rfid.transport;

import android.annotation.SuppressLint;

import java.io.File;

public class Transport_SerialPort implements IComm {
    @SuppressLint({"UseValueOf"})
    private Long hCom = new Long(0L);

    public int Connect(String paramString1, int paramInt, String paramString2) {
        File localFile = new File(paramString1);
        if ((!localFile.canRead()) || (!localFile.canWrite())) return -2;
        return NdkSupport.COMOpen(paramString1, paramInt, paramString2, this.hCom);
    }

    public int DisConnect() {
        return NdkSupport.COMClose(this.hCom.longValue());
    }

    public int Receive(byte[] paramArrayOfByte, int paramInt) {
        return NdkSupport.COMRecvBuffer(this.hCom.longValue(), paramArrayOfByte, paramInt);
    }

    public void ResetInputStream() {
        NdkSupport.COMIoflush(this.hCom.longValue());
    }

    public int Send(byte[] paramArrayOfByte, int paramInt1, int paramInt2) {
        return NdkSupport.COMSendBuffer(this.hCom.longValue(), paramArrayOfByte, paramInt1, paramInt2);
    }
}
